﻿using NMF.Languages.AnyText.ClassConstruction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NMF.Languages.AnyText
{
    public class EnumTypeTerminal : DataTypeTerminal<EnumType>
    {
        
        public EnumTypeTerminal(string name, EnumType type)
            : base(name, type)
        {

        }

        public EnumTypeTerminal(string name) : this(name, new EnumType() { Name = name }) { }

        public override DataTypeTerminal<EnumType> CreateCustom()
        {
            return new EnumTypeTerminal("Enum", new EnumType());
        }

        public override Irony.Parsing.BnfExpression CreateRule(AnyTextGrammar grammar)
        {
            return grammar.Identifier;
        }

        public override object GetValue(Irony.Parsing.ParseTreeNode node)
        {
            return DataType.ParseValue(node.Token.ValueString);
        }
    }
}
